package game.com.game;

import game.com.game.action.ShopAction;
import game.com.game.action.SleepAction;
import game.com.game.action.WorkAction;

/**
 * Created by maizhipeng on 2017/4/20.
 */

public class God {
    Persion persion;
    Shop shop;
    Commpany mCommpany;

    public void start() {
        World.getInstance().start();

        shop = new Shop();
        mCommpany = new Commpany();
        persion = new Persion("小明", new IPersionStatusListener() {
            @Override
            public void onStatusResponse(int power, long money, long time) {
                if (power <= 0) persion.setStatus(Persion.DIE_STATUS);
                else if (isTimeToSleep(time)) {
                    SleepAction sleepAction = new SleepAction();
                    persion.doAction(sleepAction);

                } else if (money > 50 && power < 50 && persion.getStatus() == Persion.NORMAL_STATUS) {
                    ShopAction shopAction = new ShopAction(shop);
                    persion.doAction(shopAction);

                } else if (power > 50 && money < 20 && persion.getStatus() == Persion.NORMAL_STATUS) {
                    WorkAction workAction = new WorkAction(mCommpany);
                    persion.doAction(workAction);
                }
            }
        });


    }

    private boolean isTimeToSleep(long time) {
        return false;
    }


}
